import Layout from '@/views/layout'
import Login from '@/views/login'
import Registered from '@/views/registered'
import Vue from 'vue'
import VueRouter from 'vue-router'

// 二级路径
import Home from '@/views/layout/home'
import User from '@/views/layout/user'
import Release from '@/views/layout/release'
import Classification from '@/views/layout/classification'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: Home,
        name: '首页'
      },
      {
        path: 'user',
        component: User,
        name: '我的'
      },
      {
        path: 'release',
        component: Release,
        name: '发布'
      },
      {
        path: '/',
        component: Layout
      },
      {
        path: 'classification',
        component: Classification,
        name: '分类'
      }
    ]
  },
  {
    path: '/',
    component: Layout
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/registered',
    component: Registered
  }
]

const router = new VueRouter({
  routes
})

export default router
